using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace TheGame
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        private Texture2D backround;
        private Texture2D beachball;
        float changeInAngle;
        private float angle = 0;
        public string AssetName;
        public Rectangle Size;
        private float mScale = 1.0f;
        Vector2 location = new Vector2(300, 240);

        public Game1()
        {
            this.Window.Title = "Faggot";
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }
        protected override void Initialize()
        {
            base.Initialize();
        }
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            beachball = Content.Load<Texture2D>("deathstar");
            backround = Content.Load<Texture2D>("stars");
        }
        protected override void UnloadContent()
        {
            // TODO: Unload any non ContentManager content here
        }
        protected override void Update(GameTime gameTime)
        {
            GamePadState gamePadState = GamePad.GetState(PlayerIndex.One);
            changeInAngle = gamePadState.ThumbSticks.Left.X;
            if (gamePadState.IsConnected)
            {
                
            }
            if (gamePadState.Buttons.X == ButtonState.Pressed)
            {
                location.X -= .2f;
            }
            if (gamePadState.Buttons.B == ButtonState.Pressed)
            {
                location.X += .2f;
            }
            base.Update(gameTime);
        }
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin();
            spriteBatch.Draw(backround, new Rectangle(0,0,800,600), Color.White);
            Rectangle sourceRectangle = new Rectangle(0, 0, beachball.Width, beachball.Height);
            Vector2 origin = new Vector2((beachball.Width / 2), beachball.Height / 2);
            spriteBatch.Draw(beachball, location, sourceRectangle, Color.White, angle, origin, 1.0f, SpriteEffects.None, 1);
            spriteBatch.End();
            base.Draw(gameTime);
        }
    }
}
